package org.example.param;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;

public class ResourceLoad {

    private static ClassLoader classLoader = ResourceLoad.class.getClassLoader();

    private static BufferedImage windowsUpdateImage;



    public static BufferedImage getWindowsUpdateImage(){
        if (windowsUpdateImage == null){
            Dimension screenSize = WindowsParam.getScreenSize();

            try {
                BufferedImage bufferedImage = ImageIO.read(classLoader.getResourceAsStream("windows_err.jpg"));

                 windowsUpdateImage = new BufferedImage(screenSize.width,screenSize.height,BufferedImage.TYPE_INT_ARGB);

                Graphics2D graphics = windowsUpdateImage.createGraphics();
                graphics.drawImage(bufferedImage,0,0,screenSize.width,screenSize.height,null);


            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return windowsUpdateImage;
    }






}
